package com.fwpsl.graph;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: 风戏fw
 * @date: 2024/4/2
 * @description: Vertex类表示图中的顶点
 */
public class Vertex<T> {

    /**
     * 顶点内容
     */
    T data;

    /**
     * 连通边
     */
    List<Edge<T>> edges;

    public Vertex(T data) {
        this.data = data;
        this.edges = new ArrayList<>();
    }

    public void addEdge(Edge edge) {
        this.edges.add(edge);
    }

    public List<Edge<T>> getEdges() {
        return edges;
    }

    public T getData() {
        return data;
    }
}
